package the_tenth_chapter;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;

public class WriteTest {

	public static void main(String[] args) {
		String s = System.getProperty("file.separator");
		String path = "C:/Users/Administrator/Desktop/1.txt";
		path = path.replace("/", s);
		File file = new File(path);
		Scanner input = null;
		Writer out = null;

		try {
			String data = null;
			input = new Scanner(System.in);
			out = new FileWriter(file);
			while (input.hasNext()) {
				data = input.nextLine();
				if (data == null) {
					data = "";
				}
				out.write(data);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				input.close();
				out.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

	}
}
